package com.chenfan.process.service;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chenfan.process.entity.dto.ApprovalQueryDTO;
import com.chenfan.process.entity.dto.RefreshDataDTO;
import com.chenfan.process.entity.po.ApprovalPo;

import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;

/**
 * @author K
 * @date 2021/3/3
 */
public interface ApprovalService extends IService<ApprovalPo> {
    ApprovalPo findApprovalByApprovalId(Long approvalId);

    @InterceptorIgnore(tenantLine = "true")
    ApprovalPo findApprovalByApprovalIdWithoutTenantId(Long approvalId);

    List<ApprovalPo> listApprovalListWithoutOption(Collection<Long> approvalIdList);

    List<ApprovalPo> pageApproval(ApprovalPo approvalPo, Integer pageNum, Integer pageSize);

    Page<ApprovalPo> pageApproval(ApprovalQueryDTO approvalQueryDTO);

    List<ApprovalPo> pageApproval(ApprovalPo approvalPo, List<Long> templateIdList, List<Long> userIdList, Integer pageNum, Integer pageSize);

    List<ApprovalPo> findApprovalList(Collection<Long> approvalIdList);

    default List<ApprovalPo> listApproving(Long templateId, List<Long> versionList) {
        return listApproving(templateId, versionList, Collections.emptyList(), null, null);
    }

    List<ApprovalPo> listApproving(Long templateId, List<Long> versionList,
                                   List<Long> approvalIdList,
                                   Date startDate, Date endDate);

    boolean checkApproval(Long templateId);

    List<ApprovalPo> listWithTemplateList(List<Long> approvalTemplateIdList);

    List<ApprovalPo> listDataFromStartAndEnd(RefreshDataDTO refreshData);

    List<ApprovalPo> findByTemplateIdAndBusiness(Long id, Long businessId, String businessCode);
}